# -*- coding: utf-8 -*-
"""
@Author: Rengar
@e-mail: rengar.fan@amutec.cn
@Date: 2024/10/11 
@Desc:
"""
from django.db import models
from rest_framework.response import Response


class DeviceChoices(models.TextChoices):
    XP02 = 'XP02', 'XP02'
    DOORBELL = 'Doorbell', 'Doorbell'
    ANALOG_SIGNAL = 'analog_signal', 'analog_signal'
    OTHER = 'other', 'other'


class PlatformChoices(models.TextChoices):
    ANDROID = 'Android', 'Android'
    IOS = 'iOS', 'iOS'
    WEB = 'Web', 'Web'
    OTHER = 'Other', 'Other'


class AppiumDriverChoices(models.TextChoices):
    UiAutomator2 = 'UiAutomator2',
    XCUITest = 'XCUITest',


class LanguageChoices(models.TextChoices):
    EN = 'en', 'English'
    ZH = 'zh', 'Chinese'


class SuccessResponse(Response):

    def __init__(self, data=None, msg='success', status=None, template_name=None, headers=None, exception=False,
                 content_type=None, code=200):
        data = {
            'code': code,
            'msg': msg,
            'data': data
        }
        super().__init__(data, status, template_name, headers, exception, content_type)


class ErrorResponse(Response):

    def __init__(self, data=None, msg='error', status=None, template_name=None, headers=None, exception=False,
                 content_type=None, code=400):
        data = {
            'code': code,
            'msg': msg,
            'data': data
        }
        super().__init__(data, status, template_name, headers, exception, content_type)
